feat: navigate the tag autocomplete with the arrow keys (#177) - #223
Merged
Conversation
When the tag pop-up is open, Up/Down now move a visible highlight through the list instead of the command history, and Tab completes the highlighted entry rather than always the first one. Outside the pop-up the arrows still walk the command history as before. `TagList` carries the selected index; it resets to the top whenever the list is rebuilt (every keystroke) and clamps at both ends. The pop-up windows the list around the selection so the highlight is always on screen, with a trailing `...` when more entries exist below. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #177.
Problem
When the
@tagautocomplete pop-up is open there is no way to move through the list — the only way to reach a tag is to type it until it becomes the first entry, which is tedious for long tag names or long lists.Solution
While the pop-up is showing, the arrow keys drive it:
The list also windows around the selection so the highlight stays on screen, with a trailing
...when more entries exist below.Implementation
TagListgains aselectedindex withselect_next/select_prev(clamped at both ends),selected(),get_selected_autocomplete()andhas_suggestions(). The index resets to the top whenever the list is rebuilt (every keystroke) and onclear().inputs_task.rs: theUp/Downarms branch onhas_suggestions()before falling through to history;handle_tab_inputuses the selected entry.graphics_task.rs:draw_autocomplete_listwindows the list around the selection and highlights the selected row.Testing
infra/tags.rsfor selection navigation, clamping, reset-on-rebuild andhas_suggestions.tag_autocomplete_down_arrow_then_tab_completes_selected_tag(tests/tui_e2e.rs):@ta→ ↓ → Tab resolves to@tag2.🤖 Generated with Claude Code